import xlrd

wb = xlrd.open_workbook(r'C:\Users\ASUS\Documents\tencent files\1404419898\filerecv\mobilefile\1_12月份衣服销售数据.xlsx')

st = wb.sheet_by_name('12月份各种服饰销售情况')

row = st.nrows
cols = st.ncols

# print(row,cols)

s = 0  # 12月份总销售额
a = 0  # a是每日销售额
y = 0
y1 = 0  # 羽绒服每日销量
n = 0
f = 0
n1 = 0
f1 = 0
p = 0
p1 = 0
t = 0
t1 = 0
c = 0
c1 = 0
num = 0

for i in range(1, row):
    data = st.row_values(i)
    a = data[2] * data[4]
    data.append(a)
    # print(data)
    s = s + data[6]
    num = num + data[4]

    if data[1] == '羽绒服':
        # y=data[6]
        # y=data[2]*data[4]
        y = y + data[6]
        y1 = y1 + data[4]

        # print(int(y))
    elif data[1] == '牛仔裤':
        # n=data[6]
        n = n + data[6]
        # print(n)
        n1 = n1 + data[4]
    elif data[1] == '风衣':
        f = f + data[6]
        f1 = f1 + data[4]

    elif data[1] == '皮草':
        p = p + data[6]
        p1 = p1 + data[4]
    elif data[1] == 'T血':
        t = t + data[6]
        t1 = t1 + data[4]
    elif data[1] == '衬衫':
        c = c + data[6]
        c1 = c1 + data[4]

print('12月份总销售额为', int(s))
print('羽绒服的销售额占比为', int(round(y / s, 2) * 100), '%')
print('牛仔裤销售额占比', int(round(n / s, 2) * 100), '%')
print('风衣的销售额占比', int(round(f / s, 2) * 100), '%')
print('皮草的销售额占比', int(round(p / s, 2) * 100), '%')
print('T恤的销售额占比', int(round(t / s, 2) * 100), '%')
print('衬衫的销售额占比', int(round(c / s, 2) * 100), '%')
print('总销售量为', num)
print('羽绒服的销售量占比为', round(y1 / num, 2))
print('牛仔裤销售量占比', round(n1 / num, 2))
print('风衣的销售量占比', round(f1 / num, 2))
print('皮草的销售量占比', round(p1 / num, 2))
print('T恤的销售量占比', round(t1 / num, 2))
print('衬衫的销售量占比', round(c1 / num, 2))
